package org.creativor.rayson.server;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.net.InetAddress;
import org.creativor.rayson.api.RpcService;
import org.creativor.rayson.common.ClientSession;
import org.creativor.rayson.demo.server.DemoServiceImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>RpcSessionImplTest</code> contains tests for the class
 * <code>{@link RpcSessionImpl}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 * 
 * @generatedBy CodePro at 11-5-7 上午2:58
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class RpcSessionImplTest
{
	/**
	 * Launch the test.
	 * 
	 * @param args
	 *            the command line arguments
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	public static void main(String[] args)
	{
		new org.junit.runner.JUnitCore().run(RpcSessionImplTest.class);
	}
	
	/**
	 * Perform pre-test initialization.
	 * 
	 * @throws Exception
	 *             if the initialization fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Before
	public void setUp() throws Exception
	{
		// TODO: add additional set up code here
	}
	
	/**
	 * Perform post-test clean-up.
	 * 
	 * @throws Exception
	 *             if the clean-up fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@After
	public void tearDown() throws Exception
	{
		// TODO: add additional tear down code here
	}
	
	/**
	 * Run the void checkProxyVersion(RpcService) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testCheckProxyVersion_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		RpcService service = new DemoServiceImpl();
		
		fixture.checkProxyVersion(service);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void checkProxyVersion(RpcService) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testCheckProxyVersion_2() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		RpcService service = new DemoServiceImpl();
		
		fixture.checkProxyVersion(service);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the byte getClientVersion() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testGetClientVersion_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		byte result = fixture.getClientVersion();
		
		// TODO: add additional test code here
		assertEquals((byte) 0, result);
	}
	
	/**
	 * Run the long getCreationTime() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testGetCreationTime_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		long result = fixture.getLastAccessedTime();
		
		// TODO: add additional test code here
		assertEquals(0L, result);
	}
	
	/**
	 * Run the InetSocketAddress getPeerAddress() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testGetPeerAddress_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		InetAddress result = fixture.getPeerAddress();
		
		// TODO: add additional test code here
		assertEquals(null, result);
	}
	
	/**
	 * Run the short getProxyVersion() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testGetProxyVersion_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		short result = fixture.getProxyVersion();
		
		// TODO: add additional test code here
		assertEquals((short) 0, result);
	}
	
	/**
	 * Run the String getServiceName() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testGetServiceName_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		String result = fixture.getServiceName();
		
		// TODO: add additional test code here
		assertEquals(null, result);
	}
	
	/**
	 * Run the RpcSessionImpl(ClientSession,RpcService) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testRpcSessionImpl_1() throws Exception
	{
		ClientSession clientSession = new ClientSession();
		RpcService service = new DemoServiceImpl();
		
		RpcSessionImpl result = new RpcSessionImpl(clientSession, service);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals(
				"{id: 0, version: 0, proxy version: 0, service name: null, creationTime: 0, remote addr: null}",
				result.toString());
		assertEquals(null, result.getServiceName());
		assertEquals(0L, result.getLastAccessedTime());
		assertEquals((byte) 0, result.getClientVersion());
		assertEquals(null, result.getPeerAddress());
		assertEquals((short) 0, result.getProxyVersion());
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:58
	 */
	@Test
	public void testToString_1() throws Exception
	{
		RpcSessionImpl fixture = new RpcSessionImpl(new ClientSession(), new DemoServiceImpl());
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		assertEquals(
				"{id: 0, version: 0, proxy version: 0, service name: null, creationTime: 0, remote addr: null}",
				result);
	}
}
